package com.jule.miaozhuapc.dao.impl;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import org.springframework.stereotype.Repository;

import com.jule.miaozhuapc.dao.WawaDao;
import com.jule.miaozhuapc.domain.WawaUser;
import com.jule.miaozhuapc.domain.WawaWawa;

@Repository
public class WawaDaoImpl   implements WawaDao{

	private EntityManager em;
	@PersistenceContext
	public void setEm(EntityManager em) {
		this.em = em;
	}

	@Override
	public WawaWawa findById(Long id) {
		// TODO Auto-generated method stub
		String hql = "from WawaWawa where id=:id and isDelete = 0";
		List<WawaWawa> wawaWawa = em.createQuery (hql).setParameter("id", id).getResultList();
		if (wawaWawa.size() > 0) {
			return wawaWawa.get(0);
		}
		return null;
	}
}
